<template>
  <div class="knowledgepoint_container" @click.stop="closeOpen">
    <div class="reportAnalysis_cont" @click.stop>
      <img src="@/images/reportAnalysis_container.png" class="knowledgepoint_contback" />
      <img src="@/images/knowledgepoint_contback1.png" class="knowledgepoint_contback1" />
      <img src="@/images/knowledgepoint_contback4.png" class="knowledgepoint_contback2" />
      <div class="reportAnalysis_btns">
        <div class="reportAnalysis_btn reportAnalysis_btn1" @click="closeOpen">关闭</div>
      </div>
      <div class="reportAnalysis_main">
        <div class="reportAnalysis_mainleft">
          <img src="@/images/reportAnalysis_mainleft.png" class="knowledgepoint_contback" />
          <img src="@/images/reportAnalysis_mainlefticon.png" class="reportAnalysis_mainlefticon" />
          <div class="reportAnalysis_maintitle">
            患者信息
          </div>
          <div class="reportAnalysis_mainlefti_cont darkScorll">
            <el-row>
              <el-col :span="7">
                <div class="reportAnalysis_mainlefti_cont1 text-ellipsis">
                  病历号：{{ infoForm.number }}
                </div>
              </el-col>
              <el-col :span="7">
                <div class="reportAnalysis_mainlefti_cont1 text-ellipsis">
                  姓名：{{ infoForm.patientName }}
                </div>
              </el-col>
              <el-col :span="5">
                <div class="reportAnalysis_mainlefti_cont1 text-ellipsis">
                  性别：{{ infoForm.patientSex == "F" ? '女' : '男' }}
                </div>
              </el-col>
              <el-col :span="5">
                <div class="reportAnalysis_mainlefti_cont1 text-ellipsis">
                  年龄：{{ infoForm.patientAge }}岁
                </div>
              </el-col>
              <el-col :span="12">
                <div class="reportAnalysis_mainlefti_cont1 text-ellipsis">
                  检查方式：<span v-if='infoForm.modalityId == item.modalityId' v-for="(item, index) in modalitys">{{
                    item.modalityName }}</span>
                </div>
              </el-col>
              <el-col :span="24">
                <div class="reportAnalysis_mainlefti_cont1 text-ellipsis">
                  提交时间：{{ reportDataInfo.createTime }}
                </div>
              </el-col>
            </el-row>
            <div class="reportAnalysis_mainlefti_cont2">
              <div class="reportAnalysis_mainlefti_cont3 darkScorll">
                <div class="reportAnalysis_mainlefti_cont4">正确的诊断报告</div>
                <div class="reportAnalysis_mainlefti_cont5">
                  <b>影像所见：</b><span v-html='infoForm.find'></span>
                </div>
                <div class="reportAnalysis_mainlefti_cont5">
                  <b>影像结论：</b><span v-html='infoForm.diagnosis'></span>
                </div>
              </div>
              <div class="reportAnalysis_mainlefti_cont3 darkScorll">
                <div class="reportAnalysis_mainlefti_cont4">我的诊断报告</div>
                <div class="reportAnalysis_mainlefti_cont5">
                  <b>影像所见：</b><span v-html='reportDataInfo.find'></span>
                </div>
                <div class="reportAnalysis_mainlefti_cont5">
                  <b>影像结论：</b><span v-html='reportDataInfo.diagnosis'></span>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="reportAnalysis_mainright">
          <div class="reportAnalysis_mainlefti_cont4 mar">分析与对比</div>
          <div class="reportAnalysis_mainright_cont1 darkScorll">
            <div v-html="markdownConverted(reportAnalysis1)"></div>
          </div>
          <div class="reportAnalysis_mainlefti_cont4 mar">报告评语</div>
          <div class="reportAnalysis_mainright_cont1 darkScorll">
            <div ref="reportAnalysis_mainright_cont" v-html="markdownConverted(reportAnalysis2)"></div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default {
  props: {
    reportAnalysis: {
      required: true,
    },
    infoForm: {
      required: true,
    },
    reportDataInfo: {
      required: true,
    },
    modalitys: {
      required: true,
    },

  },
  data() {
    return {
      reportAnalysis1: '',
      reportAnalysis2: '',
    }
  },
  mounted() {
    this.getReportAnalysis()
  },
  methods: {
    reSetReportAnalysis() {
      this.$emit('reSetReportAnalysis')
    },
    saveReportAnalysis() {
      this.$emit('saveReportAnalysis', this.$refs.reportAnalysis_mainright_cont.innerHTML)
    },
    getReportAnalysis() {
      if (this.reportAnalysis.indexOf('## 评语：') > -1) {
        this.reportAnalysis1 = this.reportAnalysis.split('## 评语：')[0]
        this.reportAnalysis2 = this.reportAnalysis.split('## 评语：')[1]
      } else {
        this.reportAnalysis1 = this.reportAnalysis
        this.reportAnalysis2 = ''
      }
      if (this.reportAnalysis1.indexOf('## 分析与对比：') > -1) {
        this.reportAnalysis1 = this.reportAnalysis1.split('## 分析与对比：')[1]
      }
    },
    closeOpen() {
      this.$emit('closeOpen')
    },
    markdownConverted(content) {
      if (!content) return '';
      return marked.parse(content);
    },
  }
}
</script>
